<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">

<div class="container-div">
    <div class="row">
        <div class="col-sm-12 select-info">
            <form id="operlog-form">
                <div class="select-list gd">
                    <ul>
                        <li>
                            员工姓名：<input type="text" name="user.name"/>
                        </li>
                        <li>
                            部门：<input type="text" name="dept.deptName"/>
                        </li>
                        <li>
                            年：<input type="text" name="dateYear" placeholder="例：2018"/>
                        </li>
                        <li>
                            月份：<input type="text" name="dateMoth" placeholder="例：8"/>
                        </li>
                        <li class="select-time">
                            <label>创建时间： </label>
                            <input type="text" class="time-input" style="width: 150px" id="beginTime" placeholder="开始时间"
                                   name="beginTime" lay-key="1">
                            <span>-</span>
                            <input type="text" class="time-input" style="width: 150px" id="overTime" placeholder="结束时间"
                                   name="overTime" lay-key="2">
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm"
                               onclick="$.table.search($('form').attr('id'))"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm"
                               onclick="$.form.reset($('form').attr('id'))"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group hidden-xs" id="toolbar" role="group">
            <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()"
               shiro:hasPermission="leave:del">
                <i class="fa fa-trash-o"></i> 删除
            </a>
        </div>
        <div class="col-sm-12 select-info order-table">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>

<div th:include="include :: footer"></div>

<script th:inline="javascript">

    var prefix = "/attendCount";
    var updateFlag = [[${@permission.hasPermi('"leave:update')}]];
    var addFlag = [[${@permission.hasPermi('"leave:add')}]];

    var morStart = "morStart";
    var morleave = "morleave";
    var noonStart = "noonStart";
    var noonleave = "noonleave";

    $(function () {
        var options = {
            url: prefix + "/tableList",
            removeUrl: prefix + "/del",
            sortName: "dateYear",  //对应数据库表述中的字段
            sortOrder: "desc",
            modalName: "考勤统计",
            search: false,
            showExport: true,
            columns: [
                {
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '编号'
                },
                {
                    field: 'userId',
                    title: '员工',
                    formatter: function (value, row) {
                        return row.user == null ? "" : row.user.name;
                    }
                },
                {
                    field: 'deptId',
                    title: '所属部门',
                    formatter: function (value, row, index) {
                        return row.dept.deptName;
                    }

                },
                {
                    field: 'dateYear',
                    title: '年份',
                    formatter: function (value, row, index) {
                        return value + " 年"
                    }
                },
                {
                    field: 'dateMoth',
                    title: '月份',

                    formatter: function (value, row, index) {

                        return value + " 月份"

                    }
                },
                {
                    field: 'leaveTimeLength',
                    title: '请假时长',
                    formatter: function (value) {
                        if (value > 60) {
                            return Math.round(value / 60 * 100) / 100 + " /时";
                        }
                        return value + " /分";
                    }
                },
                {
                    field: 'lateCount',
                    title: '迟到早退次数',
                    formatter: function (value) {
                        return value + " /次";
                    }
                },
                {
                    field: 'noAttendCount',
                    title: '未打卡次数',
                    formatter: function (value) {
                        return value + " /次";
                    }
                },
                {
                    field: 'lateTimeLength',
                    title: '迟到早退总时',
                    formatter: function (value) {
                        if (value > 60) {
                            return Math.round(value / 60 * 100) / 100 + "/时";
                        }
                        return value + "/分";
                    }
                },
                {
                    field: 'createTime',
                    title: '创建时间',
                    formatter: function (value) {
                        return $.common.dateFormat(value);
                    }
                },
                // {
                //     title: '操作',
                //     align: 'center',
                //     formatter: function (value, row, index) {
                //         var actions = [];
                //         actions.push('<a   class="' + updateFlag + 'btn btn-info btn-xs " href="#" onclick="$.operate.edit(\'' + row.procInstId + '\')"><i class="fa fa-edit"></i> 查看</a> ');
                //         actions.push('<a   class="' + updateFlag + 'btn btn-warning btn-xs " href="#" onclick="ViewProcess(\'' + row.procInstId + '\')"><i class="fa fa-edit"></i> 过程</a> ');
                //         actions.push('<a  class="' + updateFlag + 'btn btn-success btn-xs " href="#" onclick="$.operate.FlowCharPng(\'' + row.procInstId + '\')"><i class="fa fa-picture-o"></i> 流程图</a>');
                //         return actions.join('');
                //     }
                // }
                ]
        };
        $.table.init(options);
    });

</script>
</body>
</html>
